﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>


<%
dim id,reid,rs,nid,sql
dim listid,pageid
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)

		reid=Request.QueryString("reid")
		if not isnumeric(reid) then reid=0
		if reid="" then reid=0
		reid=clng(reid)

		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)
%>
<!--#include file="abcdf.asp"-->
<%
if sid="Null" then
%>
<%=title1%>
	<%=we%>请先登陆再做操作。<%=we0%>
	<%=sou%><a href="login.asp?sid=<%=sidd%>&amp;url=/bbs/viewv.asp?listid=<%=listid%>@@id=<%=id%>@@pageid=<%=pageid%>">马上登陆</a><%=we0%>
	
<%
else

	if Request.QueryString("Act")="rep" then
		Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "select nid from qingtian_bbs_reforum where [id]="&reid&""
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof) then
			nid=rs("nid")
		else
			nid=0
		end if
		Rs.close
		set rs=nothing
	else
		Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "select nid from qingtian_bbs_forum where [id]="&id&""
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof) then
			nid=rs("nid")
		else
			nid=0
		end if
		Rs.close
		set rs=nothing
	end if


		if qingtian.qx("noedit", listid)=true then
		%>
<%=title2%>
		<%=we%>出错啦!你已被禁止在本论坛修改帖子,有任何问题请联系管理员!<%=we0%>
		<%=sou%><a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%>
		<%=dao%><a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子列表</a><%=we0%>
		<%
		elseif  qingtian.bz(listid) or nid=qingtian.nid  then
				IF  Request.QueryString("Action")="save" Then
					call save
				else
					call index
				end if
		else%>
<%=title2%>
		<%=we%>你无权修改该帖子<br/>
		<a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%><%=dao%>
		<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子列表</a><%=we0%>
		<%end if
end if
end Function


Function index

dim rs,id,reid,nid,sql,run
dim listid,pageid,name,content
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)

		reid=Request.QueryString("reid")
		if not isnumeric(reid) then reid=0
		if reid="" then reid=0
		reid=clng(reid)

		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)

		run="txt" & year(now()) & month(now()) & day(now()) & hour(now()) & minute(now()) & second(now())
%>
<!--#include file="abcdf.asp"-->
<%

	if Request.QueryString("Act")="rep" then
		Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "select [content] from qingtian_bbs_reforum where [id]="&reid&""
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof) then
			content=qingtian.utf8(rs("content"))
		end if
		Rs.close
		set rs=nothing
	else
		Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "select [name],[content] from qingtian_bbs_forum where [id]="&id&""
		Rs.Open Sql,conn,1,1
		if not (rs.bof and rs.eof) then
			content=rs("content")
			name=rs("name")
		end if
		Rs.close
		set rs=nothing
	end if

%>
<%=title2%>
<%if v=0 then %>
		<%if Request.QueryString("Act")="rep" then%>
		内容:<input emptyok="true" value="<%=content%>" type="text" name="<%=run%>content" size="15"/><br/>
		<%elseif Request.QueryString("Act")="xue" then%>
                ==续写帖子==<br/>
		内容:<input emptyok="true" value="" type="text" name="<%=run%>content" size="15"/><br/>
                <%else%>
		标题:<input emptyok="true" value="<%=name%>" type="text" name="<%=run%>name" size="15"/><br/>
		内容:<input emptyok="true" value="<%=content%>" type="text" name="<%=run%>content" size="15"/><br/>
		<%end if%>
		<anchor>修改帖子
    		<go href="banji.asp?Action=save&amp;act=<%=Request.QueryString("act")%>&amp;reid=<%=reid%>&amp;id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>" method='post'>
      	  	<postfield name="name" value="$(<%=run%>name)"/>
        	<postfield name="content" value="$(<%=run%>content)"/>
    		</go>
		</anchor><br/>
<%else%>
<form action="banji.asp?Action=save&amp;act=<%=Request.QueryString("act")%>&amp;reid=<%=reid%>&amp;id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>" method="post">
		<%if Request.QueryString("Act")="rep" then%>
<%=we%>内容:<%=we0%><%=sou%><textarea name="content" rows="4"/><%=content%></textarea>
<input type="submit" value="修改帖子"/><%=we0%>
		<%elseif Request.QueryString("Act")="xue" then%>
<%=dao%>==续写帖子==<%=we0%>
<%=we%>内容:<%=we0%><%=sou%><textarea name="content" rows="4"/></textarea>
<input type="submit" value="修改帖子"/><%=we0%>
		<%else%>
<%=we%>标题:<%=we0%>
<input emptyok="true"  value="<%=name%>" type="text" maxlength="40" name="name" size="10"/><br/>
<%=we%>内容:<%=we0%><%=sou%><textarea name="content" rows="4"/><%=content%></textarea>
<input type="submit" value="修改帖子"/><%=we0%>
		<%end if%>
</form>
<%end if%>
		<%=sou%><a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%>
		<%=dao%><a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子列表</a><%=we0%>
	<%

end Function


Function save

dim id,reid,nid,sql,rs
dim listid,pageid,name,content,member,errs
		listid=Request.QueryString("listid")
		if not isnumeric(listid) then listid=0
		if listid="" then listid=0
		listid=clng(listid)

		id=Request.QueryString("id")
		if not isnumeric(id) then id=0
		if id="" then id=0
		id=clng(id)

		reid=Request.QueryString("reid")
		if not isnumeric(reid) then reid=0
		if reid="" then reid=0
		reid=clng(reid)

		pageid=Request.QueryString("pageid")
		if not isnumeric(pageid) then pageid=1
		if pageid="" then pageid=1
		pageid=clng(pageid)

		Content=qingtian.RepSQL(Request.form("Content"))
		name=qingtian.RepSQL(Request.form("name"))
		errs=""

%>
<!--#include file="abcdf.asp"-->
<%
		if len(name)<4 and Request.QueryString("Act")<>"rep" and Request.QueryString("Act")<>"xue" then errs="标题不能低于4个字。<br/>"

		if Content="" then errs="帖子内容不能为空。<br/>"



		if errs="" then
			if Request.QueryString("Act")="rep" then
				Set Rs = Server.CreateObject("Adodb.Recordset")
				Sql = "select [content] from qingtian_bbs_reforum where [id]="&reid&""
				Rs.Open Sql,conn,1,3
				if not (rs.bof and rs.eof) then
				rs("content")=content
				rs.update
				end if
				Rs.close
				set rs=nothing

			elseif Request.QueryString("Act")="xue" then
				Set Rs = Server.CreateObject("Adodb.Recordset")
				Sql = "select [name],[content] from qingtian_bbs_forum where [id]="&id&""
				Rs.Open Sql,conn,1,3
				if not (rs.bof and rs.eof) then
				rs("content")=rs("content")+content+"("&now&"被"&session("username")&"续写)"
				rs.update
				end if
				Rs.close
				set rs=nothing
                         else
                                Set Rs = Server.CreateObject("Adodb.Recordset")
				Sql = "select [name],[content] from qingtian_bbs_forum where [id]="&id&""
				Rs.Open Sql,conn,1,3
				if not (rs.bof and rs.eof) then
				rs("content")=content+"("&now&"被"&session("username")&"修改)"
				rs("name")=name
				rs.update
				end if
				Rs.close
				set rs=nothing
			end if
			%>
<%=title3%><%=we%>
			修改帖子成功。<%=we0%>
			<%
		else
			%>
<%=title2%><%=we%>
			<%=errs%>
			<a href="banji.asp?act=<%=Request.QueryString("act")%>&amp;reid=<%=reid%>&amp;id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回修改</a><%=we0%>
			<%
		end if%>
			<%=sou%><a href="viewv.asp?id=<%=id%>&amp;listid=<%=listid%>&amp;pageid=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子</a><%=we0%><%=dao%>
			<a href="board.asp?listid=<%=listid%>&amp;page=<%=pageid%>&amp;sid=<%=sidd%>">返回帖子列表</a><%=we0%>

		<%

End Function
%>
